package 力扣日常刷题.木22一月.第06天0114;

/**
 * @author 帅小伙
 * @date 2022/1/14
 * @description
 */
public class Demo02简单判断丑数 {


    public boolean isUgly(int n) {
        if (n < 0) return false;
        int[] factories = {2, 3, 5};

        for (int factory : factories) {
            while (n % factory == 0) {
                n /= factory;
            }
        }
        return n == 1;

    }
}
